home *** CD-ROM | disk | FTP | other *** search
/ Merciful 1 / Merciful - Disc 1.iso / software / l / lsd_grapevine / lsdgrapevine09a.dms / lsdgrapevine09a.adf / source / Fading.s next >
Text File  |  1990-09-06  |  3KB  |  81 lines

  1. * FADE COLOURS ROUTINE
  2.  
  3. * © 1992  DAVID 'BART' DUSTIN / KAOS PRODUCTIONS
  4.  
  5.  
  6. FADECOLS:
  7.     CMP.W     #0,FADECOUNT              ; Have we finished fading
  8.     BEQ.S     .NOFADE                   ; Don't do anything if we have
  9.     SUBQ      #1,FADECOUNT              ; Subtract one from fadecounter
  10.     
  11.     LEA       COLSPACE,A0               ; Pointer to new colours
  12.     LEA       COLS+2,A1                 ; Pointer to old colours
  13.     MOVEQ     #7,D0                     ; Number of colours -1
  14.     MOVEQ     #4,D1                     ; Distance between colours
  15.  
  16. .FADELOOP
  17.     MOVE.W    #%1111000000000000,D4     ; We only want one col at a time
  18.     
  19.     BSR.S     .DOWORK
  20.     BEQ.S     .NORED
  21.     BGT.S     .SUBRED
  22.  
  23.     ADD.W     #$0200,(A1)                ; Increase Red value
  24.  
  25. .SUBRED
  26.     SUB.W     #$0100,(A1)                ; Decrease Red value
  27.  
  28. .NORED
  29.     BSR.S     .DOWORK
  30.     BEQ.S     .NOGREEN
  31.     BGT.S     .SUBGREEN
  32.  
  33.     ADD.W     #$0020,(A1)                ; Increase Green value
  34.  
  35. .SUBGREEN
  36.     SUB.W     #$0010,(A1)                ; Decrease Green value
  37.  
  38. .NOGREEN
  39.     BSR.S     .DOWORK
  40.     BEQ.S     .NOBLUE
  41.     BGT.S     .SUBBLUE
  42.  
  43.     ADDQ.W    #$0002,(A1)               ; Increase Blue value
  44.  
  45. .SUBBLUE
  46.     SUBQ.W    #$0001,(A1)               ; Decrease Blue value
  47.  
  48. .NOBLUE
  49.     LEA       2(A0),A0                  ; Advance to next colour (word)
  50.     ADD.L     D1,A1                     ; Distance between cols
  51.     DBRA      D0,.FADELOOP
  52.  
  53. .NOFADE
  54.     RTS                                 ; Exit from sub-routine
  55.  
  56. ***************************************
  57. .DOWORK
  58.     LSR.W     #4,D4                     ; Advance to next value
  59.     MOVE.W    (A0),D2                   ; Get new colour value
  60.     MOVE.W    (A1),D3                   ; Get current colour value
  61.     AND.W     D4,D2                     ; Only work with one section
  62.     AND.W     D4,D3                     ; Only work with one section
  63.     CMP.W     D2,D3                     ; Compare two values
  64.     RTS
  65.  
  66.  
  67. **********************************************************************
  68. **********************************************************************
  69. FADECOUNT:
  70.     DC.W      16                        ; Maximum number of loops
  71.  
  72. ***************************************
  73. COLOURS:                                ; Table of new colours
  74.     DC.W      $000,$222,$444,$666,$888,$AAA,$CCC,$EEE
  75.  
  76.  
  77. *********************************************************************
  78. COLS:                                   ; Colour palette in CopperList
  79.     DC.L      $01800000,$01820000,$01840000,$01860000
  80.     DC.L      $01880000,$018A0000,$018C0000,$018E0000
  81.